home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
8_13.lha
/
8_13
/
tst13b.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
713b
|
36 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
include <pat.h>
ain()
pat p(cin);
int x, y;
float f;
char s[100];
if (p.match("Name:")) {
cout << "match 1 %s %f %d succeeded\n";
p >> s >> f >> y >> x;
} else if (p.match("Hello:")) {
cout << "match 2 %s %f %d succeeded\n";
p >> s >> f >> x >> y;
} else {
cout << "default succeeded\n";
p >> s >> x >> y >> f;
}
cout << "s = '" << s << "'\n"
<< "x = '" << x << "'\n"
<< "y = '" << y << "'\n"
<< "f = '" << f << "'\n";
int a = -1, b = -2;
p >> a >> b;
cout << "a = " << a << "\n"
<< "b = " << b << "\n";
return 0;